package com.zhong.gang.pda.ui.carorder;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhong.gang.applib.utils.TimeUtils;
import com.zhong.gang.pda.R;

public class OrderNumAdapter extends BaseQuickAdapter<OrderNumBean, BaseViewHolder> {
    public OrderNumAdapter() {
        super(R.layout.item_order_num);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderNumBean item) {
        TextView startAddress = helper.getView(R.id.start_address);
        TextView carMsg = helper.getView(R.id.car_msg);
        TextView carName = helper.getView(R.id.car_name);
        TextView phone = helper.getView(R.id.phone);
        TextView msgTv = helper.getView(R.id.msg_tv);
        TextView carTV = helper.getView(R.id.car);
        TextView carTitle = helper.getView(R.id.car_name_title);
        TextView phoneTitle = helper.getView(R.id.phone_title);
        TextView carInfoTitle = helper.getView(R.id.car_info);
        TextView carInfo = helper.getView(R.id.car_info_text);
        TextView phoneLeft = helper.getView(R.id.phone_left);
        TextView phoneNumber = helper.getView(R.id.phone_number);
        carInfoTitle.setText("司机姓名:");
        phoneLeft.setText("电话号码:");
        OrderNumBean.TransportCarBean carBean = item.getTransportCar();
        if (null != carBean) {
            carInfo.setText(carBean.getDriverName());
            phoneNumber.setText(carBean.getDriverPhone());
        }
        carTV.setText("货车信息:");
        msgTv.setText("发货地址:");
        carTitle.setText("送货地址:");
        phoneTitle.setText("派车时间:");
        startAddress.setText(String.format("%s-%s", item.getCarNum(), item.getCarTypeName()));
        carMsg.setText(item.getStartLocal());
        carName.setText(item.getEndLocal());
        phone.setText(item.getCreateTime());
//        if (item.getTransportCar() != null){
//            msgTv.setText("货车信息");
//            carTV.setText("收货地点");
//            carTitle.setText("司机");
//            phoneTitle.setText("电话");
//            helper.getView(R.id.car_name_layout).setVisibility(View.VISIBLE);
//            helper.getView(R.id.car_phone_layout).setVisibility(View.VISIBLE);
//            startAddress.setText(""+item.getEndLocal());
//            carMsg.setText(""+item.getCarNum()+(TextUtils.isEmpty(item.getCarTypeName())?"":("-"+item.getCarTypeName())));
//            carName.setText(""+item.getTransportCar().getDriverName());
//            phone.setText(""+item.getTransportCar().getDriverPhone());
//        }else {
//            carTV.setText("车牌号:");
//            msgTv.setText("发货地址:");
//            carTitle.setText("送货地址:");
//            phoneTitle.setText("派车时间:");
//            startAddress.setText(item.getCarNum());
//            carMsg.setText(item.getStartLocal());
//            carName.setText(item.getEndLocal());
//            phone.setText(item.getCreateTime());
//        }
    }
}
